load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "protoc",
    srcs = [
        "depsresolver.go",
        "file.go",
        "intent.go",
        "language_config.go",
        "language_plugin_config.go",
        "language_rule.go",
        "language_rule_config.go",
        "other_proto_library.go",
        "package.go",
        "package_config.go",
        "plugin.go",
        "plugin_configuration.go",
        "plugin_context.go",
        "plugin_registry.go",
        "proto_compile.go",
        "proto_compiled_sources.go",
        "proto_descriptor_set.go",
        "proto_library.go",
        "protoc_configuration.go",
        "registry.go",
        "resolver.go",
        "rewrite.go",
        "rule_provider.go",
        "rule_registry.go",
        "ruleindex.go",
        "starlark_plugin.go",
        "starlark_rule.go",
        "starlark_util.go",
        "syntaxutil.go",
        "yconfig.go",
    ],
    importpath = "github.com/stackb/rules_proto/pkg/protoc",
    visibility = ["//visibility:public"],
    deps = [
        "@bazel_gazelle//config:go_default_library",
        "@bazel_gazelle//label:go_default_library",
        "@bazel_gazelle//resolve:go_default_library",
        "@bazel_gazelle//rule:go_default_library",
        "@com_github_bazelbuild_buildtools//build:go_default_library",
        "@com_github_emicklei_proto//:proto",
        "@in_gopkg_yaml_v3//:yaml_v3",
        "@net_starlark_go//starlark",
        "@net_starlark_go//starlarkstruct",
    ],
)

go_test(
    name = "protoc_test",
    srcs = [
        "depsresolver_test.go",
        "fake_proto_library_test.go",
        "file_test.go",
        "intent_test.go",
        "language_config_test.go",
        "language_rule_config_test.go",
        "other_proto_library_test.go",
        "package_config_test.go",
        "package_test.go",
        "proto_plugin_config_test.go",
        "protoc_configuration_test.go",
        "resolver_test.go",
        "rewrite_test.go",
        "starlark_plugin_test.go",
        "starlark_rule_test.go",
        "starlark_util_test.go",
    ],
    embed = [":protoc"],
    deps = [
        "@bazel_gazelle//config:go_default_library",
        "@bazel_gazelle//label:go_default_library",
        "@bazel_gazelle//resolve:go_default_library",
        "@bazel_gazelle//rule:go_default_library",
        "@com_github_emicklei_proto//:proto",
        "@com_github_google_go_cmp//cmp",
        "@com_github_google_go_cmp//cmp/cmpopts",
        "@com_github_stretchr_testify//assert",
        "@net_starlark_go//starlark",
        "@net_starlark_go//starlarkstruct",
    ],
)

filegroup(
    name = "all_files",
    testonly = True,
    srcs = [
        "BUILD.bazel",
    ] + glob(["*.go"]),
    visibility = ["//pkg:__pkg__"],
)
